<template>
  <div class="edit">
    <div class="main">
      <div class="name">姓名 <input type="text" v-model="name" /></div>
      <div class="sex">
        性别
        <select v-model="sex" name="sex">
          <option value="1">男</option>
          <option value="2">女</option>
        </select>
      </div>
      <div class="name">签名 <input type="text" v-model="qianming" /></div>
      <div class="sex">
        学科
        <select v-model="object">
          <option value="1">语文</option>
          <option value="2">数学</option>
          <option value="3">英语</option>
          <option value="4">文综</option>
          <option value="5">理综</option>
        </select>
      </div>
      <div class="sex">
        职位
        <select v-model="zhiwei" name="职位">
          <option value="CEO">CEO</option>
          <option value="2"></option>
          <option value="3"></option>
          <option value="4"></option>
          <option value="5"></option>
        </select>
      </div>
      <div class="name">参与项目 <input type="text" v-model="xiangmu" /></div>
      <div class="name">自我介绍 <input type="text" v-model="jieshao" /></div>
      <div id="submit" style="border:0">
        <button @click="submit">全部保存</button>
      </div>
    </div>
    <section class="wmassageMask" v-show="writeMessageShow">
      <div class="tk">
        <p>登陆成功</p>
        <p class="border"></p>
        <button @click="qd">确定</button>
      </div>
    </section>

    <section class="wmassageMask" v-show="writeMessageShow1">
      <div class="tk">
        <p>账号或密码错误</p>
        <p class="border"></p>
        <button @click="qd1">确定</button>
      </div>
    </section>
  </div>
</template>
<style scoped>
* {
  color: #5b5b5b;
}
.main {
  width: 90%;
  margin: 4rem auto;
}
.main > div {
  padding: 0 0 1rem;
  border-bottom: 1px solid #ccc;
  margin-top: 1rem;
}
.name input {
  border: none;
  margin-left: 2rem;
  width: 11rem;
}
.sex select {
  margin-left: 2rem;
  border: 0;
  -webkit-appearance: none;
  width: auto;
  padding: 0 2rem;
  margin: 0;
}
#submit {
  margin-top: 6rem;
}
#submit button {
  border: 0;
  width: 50%;
  margin: 0 auto;
  color: #fff;
  padding: 0.8rem 0;
  background: #d33738;
  border-radius: 2rem;
  display: block;
}
</style>
<script>
import axios from "axios";
export default {
  data() {
    return {
      name: "",
      sex: "",
      object: "",
      qianming: "",
      zhiwei: "",
      xiangmu: "阿里",
      jieshao: "介绍",
      main: [], //all
      writeMessageShow: false,
      writeMessageShow1: false,
    };
  },
  methods: {
    submit() {
      let that = this;
      axios
        .post("/Teaname/publish", {
          id: localStorage.getItem("ids"),
          name: that.name,
        })
        .then((res) => console.log(res));
      axios
        .post("/Teasex/publish", {
          id: localStorage.getItem("ids"),
          sex: that.sex,
        })
        .then((res) => console.log(res));
      axios
        .post("Teasubject/publish", {
          id: localStorage.getItem("ids"),
          subject_id: that.object,
        })
        .then((res) => console.log(res.data));
      axios
        .post("/Teapublish/publish", {
          id: localStorage.getItem("ids"),
          title: that.qianming,
        })
        .then((res) => console.log(res.data));
    },
  },
  created() {
    let that = this;
   
    axios
      // .post("/Personal/index?id=90")
      .post("/Personal/index", { id: localStorage.getItem("ids") })
      .then((res) => {
        console.log(res.data.data);
        that.main = res.data.data;
        that.jieshao = res.data.data.content;
        that.name = res.data.data.name;
        that.sex = res.data.data.sex;
        that.object = res.data.data.subject_id;
        that.zhiwei = res.data.data.position;
        that.xiangmu = res.data.data.research;
        that.qianming = res.data.data.title;
      });
    
  },
};
</script>



